#
# 学会放松模块
#


import datetime

from rasa_sdk.executor import CollectingDispatcher
from typing import Text, Dict, Any, List

from rasa_sdk import Action, Tracker
from rasa_sdk.events import SlotSet, SessionStarted, UserUtteranceReverted
from actions import common
import requests
import re
import time


def current_thought(tracker):
    num = tracker.get_slot('thought_3_change_1')
    cur = 'thought_' + str(num)
    text = tracker.get_slot(cur)
    return text


def conversation_rounds(tracker, **type):
    try:
        if common.rediscommon().get(tracker.current_state()['sender_id'] + '-wx-block-module2'):
            r = common.rediscommon()
            userid = tracker.current_state()['sender_id']
            r.set(userid + 'TempTimeSteame', str(time.time()), ex=86400)
            common.rediscommon().delete(tracker.current_state()['sender_id'] + '-wx-block-module2')
            return []
    except:
        pass
    if 'type' in type:
        if type['type'] == 1:
            userid = tracker.current_state()['sender_id']
            conn = common.POOL.connection(shareable=False)
            cursor = conn.cursor()
            cursor.execute(
                "Select * from `user_result` where topic_type=3 and is_end=0 and user_info_id ='" + userid + "' order by create_time desc")
            x = cursor.fetchone()
            sql = "update `user_result` set conversation_rounds=" + str(x[15] + 1) + ",is_part_know=1 where `user_info_id` ='" + userid + "' and `is_end` = 0 and `topic_type` =3 order by create_time desc limit 1;"
            common.connectmysql(sql)
            return []
    userid = tracker.current_state()['sender_id']
    conn = common.POOL.connection(shareable=False)
    cursor = conn.cursor()
    cursor.execute(
        "Select * from `user_result` where topic_type=3 and is_end=0 and user_info_id ='" + userid + "' order by create_time desc")
    x = cursor.fetchone()
    if x[18] not in [(),None,]:
        r = common.rediscommon()
        try:
            temp = float(r.get(userid + 'TempTimeSteame'))
        except:
            temp = 0
        timenow = time.time()
        c = round(timenow - temp, 3)
        if x[18] == 0.001:
            sql = "update `user_result` set conversation_rounds=" + str(x[15] + 1) + ",response_time=" + str(
                c) + " where `user_info_id` ='" + userid + "' and `is_end` = 0 and `topic_type` =3 order by create_time desc limit 1;"
            common.connectmysql(sql)
        else:
            sql = "update `user_result` set conversation_rounds=" + str(x[15] + 1) + ",response_time=" + str(x[18] + c) + " where `user_info_id` ='" + userid + "' and `is_end` = 0 and `topic_type` =3 order by create_time desc limit 1;"
            common.connectmysql(sql)
        r.set(userid + 'TempTimeSteame', str(time.time()), ex=86400)
    else:
        r = common.rediscommon()
        r.set(userid + 'TempTimeSteame', str(time.time()), ex=86400)
        sql = "update `user_result` set conversation_rounds=" + str(x[15] + 1) + ",response_time=0.000 where `user_info_id` ='" + userid + "' and `is_end` = 0 and `topic_type` =3 order by create_time desc limit 1;"
        common.connectmysql(sql)
    return []


class part13_1_1_choose_1(Action):
    def name(self) -> Text:
        return "action_part13_1_1_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        userid = tracker.current_state()['sender_id']
        conn = common.POOL.connection(shareable=False)
        cursor = conn.cursor()
        try:
            cursor.execute(
                "Select * from `user_info` where `id` = '" + userid + "';")
            x = cursor.fetchone()
            nickname = x[1]
            names = x[2]
            if nickname is None:
                nickname = ''
            if names is None:
                names = ''
            test_batch=str(x[35])
            sql = "insert into `user_result`(`id`,`user_info_id`,`topic_type`,`name`,`conversation_rounds`,`nick_name`,`test_batch`) values('" + common.getuid() + "','" + userid + "',3,'" + names + "',0,'" + nickname + "',"+str(x[35])+");"
            common.connectmysql(sql)
            cursor.close()
            conn.close()
            conn = common.POOL.connection(shareable=False)
            cursor = conn.cursor()
            cursor.execute(
                "Select * from `user_result` where `user_info_id` = '" + userid + "' and `is_end` = 0 and `topic_type` = 3 order by create_time desc limit 1;")
            x = cursor.fetchone()
            sql = "insert into `user_tools_response` (`id`,`user_info_id`,`user_result_id`,`name`,`use_tools`,`nick_name`,`test_batch`) values('" + common.getuid() + "','" + \
                  userid + "','" + x[0] + "','" + names + "','学会放松','" + nickname + "',"+test_batch+");"
            common.connectmysql(sql)
        except:
            dispatcher.utter_message(text='机器人错误 错误码0x006')
            return [UserUtteranceReverted()]
        finally:
            cursor.close()
            conn.close()
        dispatcher.utter_message(text='好的,先让你的身体准备好进行一些有意识的呼吸开始吧，这种呼吸方式又叫做正念呼吸。', buttons=[
            {'payload': '/button_part13_1_2_choose_1', 'title': '好的', 'life': 1}, ], json_message={"module_type": 2,"word_module_type":5})
        return []


class part13_1_2_choose_1(Action):
    def name(self) -> Text:
        return "action_part13_1_2_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='首先，选择一个舒适的姿势坐下或者躺下，你更喜欢哪个都可以', buttons=[
            {'payload': '/button_part13_1_3_choose_1', 'title': '我想要坐着', 'life': 1},
            {'payload': '/button_part13_1_3_choose_2', 'title': '我想要躺着', 'life': 1}, ])
        return []


class part13_1_3_choose_1(Action):
    def name(self) -> Text:
        return "action_part13_1_3_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='好的,找到一个安静的地方坐下后，将双脚放在地板上，并尽量坐得高一些')
        dispatcher.utter_message(text='想象一下，你靠着墙坐着，将脊椎压在平坦、笔直的墙面上  ', buttons=[
            {'payload': '/button_part13_1_4_choose_1', 'title': '我能看看例子吗？', 'life': 1},
            {'payload': '/button_part13_1_4_choose_2', 'title': '好的', 'life': 1},
            {'payload': '/button_part13_1_4_choose_3', 'title': '这样子坐着我有点不舒服', 'life': 1},
            {'payload': '/button_part13_1_4_choose_4', 'title': '我找不到一个可以坐的地方', 'life': 1}, ])
        return []


class part13_1_3_choose_2(Action):
    def name(self) -> Text:
        return "action_part13_1_3_choose_2"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='好的。 找一个安静的舒服的地方躺下——可以是地板、床或沙发。保持双腿伸直，让你的身体沉入下面的地面。', buttons=[
            {'payload': '/button_part13_1_4_choose_4', 'title': '我想躺下再试一次', 'life': 1},
            {'payload': '/button_part13_1_4_choose_2', 'title': '好的，我准备好啦', 'life': 1},
            {'payload': '/button_part13_1_4_choose_3', 'title': '我找不到一个舒服的状态', 'life': 1},
            {'payload': '/button_part13_1_4_choose_5', 'title': '我没找到合适的地方', 'life': 1}, ])
        return []


class part13_1_4_choose_1(Action):
    def name(self) -> Text:
        return "action_part13_1_4_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        url = 'https://obs-e912.obs.cn-east-2.myhuaweicloud.com/zy_xm/image/rasa_photo_2021_08_16/relax/mindfulness_sit.png'
        dispatcher.utter_message(text='当然可以啦~这是一个典型的正念冥想姿势的样子', image=url, buttons=[
            {'payload': '/button_part13_1_4_choose_2', 'title': '我明白啦', 'life': 1}, ])
        return []


class part13_1_4_choose_2(Action):
    def name(self) -> Text:
        return "action_part13_1_4_choose_2"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        url = 'https://obs-e912.obs.cn-east-2.myhuaweicloud.com/zy_xm/image/rasa_photo_2021_08_16/relax/little_E_breath_1~1.mp4'
        dispatcher.utter_message(text='现在，把你的注意力转移到你的呼吸上。慢慢地吸气，并且默数到3……,再缓慢地呼气，默数到4……,如果你愿意，你可以随着我肚子的形状吸气和呼气', buttons=[
            {'payload': '/button_part13_1_5_choose_1', 'title': '已经调整好我的呼吸啦✔', 'life': 1}, ], json_message={
            "module_type": 2,
            "video": "little_E_breath_1", })
        return []


class part13_1_4_choose_3(Action):
    def name(self) -> Text:
        return "action_part13_1_4_choose_3"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='我明白了。 你知道，很多人在第一次开始正念练习时会感到不安或紧张。')
        dispatcher.utter_message(text='这类似于尝试一项新运动，比如游泳或瑜伽。 有点不舒服是学习过程的一部分。')
        dispatcher.utter_message(text='现在，尽量集中注意力。 你练习得越多，它就会变得越容易的！~', buttons=[
            {'payload': '/button_part13_1_4_choose_2', 'title': '好的', 'life': 1}, ])
        return []


class part13_1_4_choose_4(Action):
    def name(self) -> Text:
        return "action_part13_1_4_choose_4"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='没关系。 很难找到一个私人的、平静的地方。我有一个不同的练习，可以通过专注于你的五种感官来帮助你感觉集中——这在繁忙的环境中会好一点。你想尝试一下吗？ ',
                                 buttons=[
                                     {'payload': '/button_part15_1_1_choose_1', 'title': '好', 'life': 1},
                                     {'payload': '/button_part13_1_3_choose_2', 'title': '我想躺下再试一次', 'life': 1}, ])
        return []


class part13_1_4_choose_5(Action):
    def name(self) -> Text:
        return "action_part13_1_4_choose_5"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='没关系。 很难找到一个私人的、平静的地方。我有一个不同的练习，可以通过专注于你的五种感官来帮助你感觉集中——这在繁忙的环境中会好一点。你想尝试一下吗？ ',
                                 buttons=[
                                     {'payload': '/button_part15_1_1_choose_1', 'title': '好呀', 'life': 1},
                                     {'payload': '/button_part13_1_3_choose_1', 'title': '我想要坐着再试一次', 'life': 1}, ])
        return []


class part13_1_5_choose_1(Action):
    def name(self) -> Text:
        return "action_part13_1_5_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='当你继续呼吸时，注意每一次呼吸进入你身体时的感觉。')
        dispatcher.utter_message(text='比如，你可以认真体会凉爽的空气流入你的鼻孔或嘴巴时的感觉。', buttons=[
            {'payload': '/button_part13_1_6_choose_1', 'title': '好的', 'life': 1}, ])
        return []


class part13_1_6_choose_1(Action):
    def name(self) -> Text:
        return "action_part13_1_6_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='现在，专注于呼气的感觉。你可能会感觉到空气从你的嘴唇流过，或者在你呼气时听到轻微的急促声 🌬️', buttons=[
            {'payload': '/button_part13_1_7_choose_1', 'title': '明白了', 'life': 1}, ])
        return []


class part13_1_7_choose_1(Action):
    def name(self) -> Text:
        return "action_part13_1_7_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='在你下次吸气时，慢慢来。尽可能地慢慢吸气')
        dispatcher.utter_message(text='注意你的胸部和腹部如何膨胀--几乎像一个气球一样')
        dispatcher.utter_message(text='当它们充满气体时，屏住呼吸，缓慢地数三下......', buttons=[
            {'payload': '/button_part13_1_8_choose_1', 'title': '屏住呼吸......', 'life': 1}, ])
        return []


class part13_1_8_choose_1(Action):
    def name(self) -> Text:
        return "action_part13_1_8_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='现在呼气，慢慢数到四。当你呼气时，注意你整个身体的感觉。')
        dispatcher.utter_message(text='你的胸部、腹部和肩膀向下沉时，你可能会体验到一种放松的感觉……', buttons=[
            {'payload': '/button_part14_1_1_choose_1', 'title': '呼气……', 'life': 1}, ])
        return []


class part14_1_1_choose_1(Action):
    def name(self) -> Text:
        return "action_part14_1_1_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        userid = tracker.current_state()['sender_id']
        conversation_rounds(tracker)
        x = common.getuserinfo(userid)
        nickname = x[1]
        names = x[2]
        if names not in [None,'']:
            rname=names
        else:
            rname=nickname
        dispatcher.utter_message(text='干得好，'+rname+'。现在，试着再做三次有意识的呼吸看看你是否能像我们刚才那样，专注于每一次的感觉。如果你愿意，你可以继续跟着我肚子里的形状走。',
                                 json_message={
                                     "module_type": 2,
                                     "video": "little_E_breath_1", }, buttons=[
                {'payload': '/button_part14_1_2_choose_1', 'title': '好的，我成功啦', 'life': 1},
                {'payload': '/button_part14_1_2_choose_2', 'title': '你能引导我一下吗？', 'life': 1}, ])
        return []


class part14_1_2_choose_1(Action):
    def name(self) -> Text:
        return "action_part14_1_2_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='做得很好！将注意力集中到你的呼吸上的确需要一些努力,你现在感觉怎么样？', buttons=[
            {'payload': '/button_part14_1_3_choose_1', 'title': '没啥变化', 'life': 1},
            {'payload': '/button_part14_1_3_choose_2', 'title': '不错', 'life': 1},
            {'payload': '/button_part14_1_3_choose_3', 'title': '更不好了', 'life': 1}, ])
        return []


class part14_1_2_choose_2(Action):
    def name(self) -> Text:
        return "action_part14_1_2_choose_2"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='当然可以啦，让我们一起吸气，慢慢数到三……然后保持住再数到三，注意你胸部和腹部的充实度', buttons=[
            {'payload': '/button_part14_1_3_choose_4', 'title': '保持住我的呼吸……', 'life': 1}, ])
        return []


class part14_1_3_choose_1(Action):
    def name(self) -> Text:
        return "action_part14_1_3_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        userid = tracker.current_state()['sender_id']
        conn = common.POOL.connection(shareable=False)
        cursor = conn.cursor()
        try:
            cursor.execute(
                "Select * from `user_result` where `user_info_id` = '" + userid + "' and `is_end` = 0 and `topic_type` = 3 order by create_time desc limit 1;")
            x = cursor.fetchone()
            result_id = x[0]
            sql = "update user_tools_response set feeling_relax_breath_littleE='没啥变化' where `user_info_id` ='" + userid + "' and `user_result_id` = '" + result_id + "' limit 1;"
            common.connectmysql(sql)
        except:
            dispatcher.utter_message(text='机器人错误 错误码0x050')
            return [UserUtteranceReverted()]
        finally:
            cursor.close()
            conn.close()
        dispatcher.utter_message(text='我知道了。其实，当谈到正念呼吸时，感觉相同往往是一件好事。')
        dispatcher.utter_message(text='如果你现在感觉不好，想要感觉更好，第一步就是要防止自己进一步沉沦在这些负面的感觉中。')
        dispatcher.utter_message(text='所以事实是 你让自己不再感觉更糟就已经是一种胜利啦！👍', buttons=[
            {'payload': '/button_part14_1_4_choose_1', 'title': '很有道理', 'life': 1}, ])
        return []


class part14_1_3_choose_2(Action):
    def name(self) -> Text:
        return "action_part14_1_3_choose_2"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        userid = tracker.current_state()['sender_id']
        conn = common.POOL.connection(shareable=False)
        cursor = conn.cursor()
        try:
            cursor.execute(
                "Select * from `user_result` where `user_info_id` = '" + userid + "' and `is_end` = 0 and `topic_type` = 3 order by create_time desc limit 1;")
            x = cursor.fetchone()
            result_id = x[0]
            sql = "update user_tools_response set feeling_relax_breath_littleE='不错' where `user_info_id` ='" + userid + "' and `user_result_id` = '" + result_id + "' limit 1;"
            common.connectmysql(sql)
        except:
            dispatcher.utter_message(text='机器人错误 错误码0x050')
            return [UserUtteranceReverted()]
        finally:
            cursor.close()
            conn.close()
        dispatcher.utter_message(text='耶！很高兴对你有所帮助', buttons=[
            {'payload': '/button_part14_1_4_choose_2', 'title': '（づ￣3￣）づ╭❤～', 'life': 1}, ])
        return []


class part14_1_3_choose_3(Action):
    def name(self) -> Text:
        return "action_part14_1_3_choose_3"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        userid = tracker.current_state()['sender_id']
        conn = common.POOL.connection(shareable=False)
        cursor = conn.cursor()
        try:
            cursor.execute(
                "Select * from `user_result` where `user_info_id` = '" + userid + "' and `is_end` = 0 and `topic_type` = 3 order by create_time desc limit 1;")
            x = cursor.fetchone()
            result_id = x[0]
            sql = "update user_tools_response set feeling_relax_breath_littleE='更不好了' where `user_info_id` ='" + userid + "' and `user_result_id` = '" + result_id + "' limit 1;"
            common.connectmysql(sql)
        except:
            dispatcher.utter_message(text='机器人错误 错误码0x050')
            return [UserUtteranceReverted()]
        finally:
            cursor.close()
            conn.close()
        dispatcher.utter_message(text='谢谢你告诉我你的感受。我们一直期望着正念呼吸能帮助人们感到更平静。但有时，这可能会非常困难，失败的经历也会让人感到沮丧。你今天有遇到这些问题吗？',
                                 buttons=[
                                     {'payload': '/button_part14_1_4_choose_3', 'title': '我没办法集中精力……', 'life': 1},
                                     {'payload': '/button_part14_1_4_choose_4', 'title': '我周围的环境太吵了', 'life': 1},
                                     {'payload': '/button_part14_1_4_choose_5', 'title': '我更想有个音频引导我', 'life': 1},
                                     {'payload': '/actives_relax_form1', 'title': '哪个都不是', 'life': 1}, ])
        return []


class part14_1_3_choose_4(Action):
    def name(self) -> Text:
        return "action_part14_1_3_choose_4"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='现在，呼气数到四。注意放松你的肋骨，听到空气从你的鼻子和嘴里流出时的轻柔冲击', buttons=[
            {'payload': '/button_part14_1_4_choose_6', 'title': '呼气……', 'life': 1}, ])
        return []


class part14_1_4_choose_1(Action):
    def name(self) -> Text:
        return "action_part14_1_4_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='我很高兴你同意。 还有一件事：这种呼吸方式其实对任何人来说都很难做好。')
        dispatcher.utter_message(text='一些佛教僧侣为了掌握正念，年复一年地练习着。')
        dispatcher.utter_message(text='所以如果你继续练习，可能它会慢慢变得更有帮助 ', buttons=[
            {'payload': '/button_part14_1_5_choose_1', 'title': '好的', 'life': 1}, ])
        return []


class part14_1_4_choose_2(Action):
    def name(self) -> Text:
        return "action_part14_1_4_choose_2"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='感谢你今天花一些时间保持正念。下次需要的时候也可以回来练习哦你练习这些东西越多，它就会越容易、越有收获——就像今天一样！', buttons=[
            {'payload': '/button_part14_1_5_choose_2', 'title': '我从哪里可以找到这个工具呢？', 'life': 1},
            {'payload': '/button_part14_1_5_choose_3', 'title': '知道啦', 'life': 1}, ])
        return []


class part14_1_4_choose_3(Action):
    def name(self) -> Text:
        return "action_part14_1_4_choose_3"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        userid = tracker.current_state()['sender_id']
        conn = common.POOL.connection(shareable=False)
        cursor = conn.cursor()
        try:
            cursor.execute(
                "Select * from `user_result` where `user_info_id` = '" + userid + "' and `is_end` = 0 and `topic_type` = 3 order by create_time desc limit 1;")
            x = cursor.fetchone()
            result_id = x[0]
            sql = "update user_tools_response set feeling_relax_breath_littleE_reason='我没办法集中精力……' where `user_info_id` ='" + userid + "' and `user_result_id` = '" + result_id + "' limit 1;"
            common.connectmysql(sql)
        except:
            dispatcher.utter_message(text='机器人错误 错误码0x050')
            return [UserUtteranceReverted()]
        finally:
            cursor.close()
            conn.close()

        dispatcher.utter_message(text='我明白了。其实，你走神也没关系。')
        dispatcher.utter_message(text='如果你在这个练习中能够专注于你的呼吸，哪怕是短暂的片刻，那也是一种胜利。', buttons=[
            {'payload': '/button_part14_1_5_choose_4', 'title': '真的吗？', 'life': 1},
            {'payload': '/button_part14_1_5_choose_5', 'title': '我也这么觉得', 'life': 1}, ])
        return []


class part14_1_4_choose_4(Action):
    def name(self) -> Text:
        return "action_part14_1_4_choose_4"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        userid = tracker.current_state()['sender_id']
        conn = common.POOL.connection(shareable=False)
        cursor = conn.cursor()
        try:
            cursor.execute(
                "Select * from `user_result` where `user_info_id` = '" + userid + "' and `is_end` = 0 and `topic_type` = 3 order by create_time desc limit 1;")
            x = cursor.fetchone()
            result_id = x[0]
            sql = "update user_tools_response set feeling_relax_breath_littleE_reason='我周围的环境太吵了' where `user_info_id` ='" + userid + "' and `user_result_id` = '" + result_id + "' limit 1;"
            common.connectmysql(sql)
        except:
            dispatcher.utter_message(text='机器人错误 错误码0x050')
            return [UserUtteranceReverted()]
        finally:
            cursor.close()
            conn.close()
        dispatcher.utter_message(text='我知道了。 噪音肯定会让你难以集中注意力在呼吸上。如果你愿意，我们可以尝试不同的运动来给你带来一些平静和解脱。这是关于调整你的五种感官，所以它可以随时随地进行',
                                 buttons=[
                                     {'payload': '/button_part15_1_2_choose_1', 'title': '好耶，我想试试', 'life': 1},
                                     {'payload': '/button_part14_1_4_choose_2', 'title': '我今天不想继续了', 'life': 1}, ])
        return []


class part14_1_4_choose_5(Action):
    def name(self) -> Text:
        return "action_part14_1_4_choose_5"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        userid = tracker.current_state()['sender_id']
        conn = common.POOL.connection(shareable=False)
        cursor = conn.cursor()
        try:
            cursor.execute(
                "Select * from `user_result` where `user_info_id` = '" + userid + "' and `is_end` = 0 and `topic_type` = 3 order by create_time desc limit 1;")
            x = cursor.fetchone()
            result_id = x[0]
            sql = "update user_tools_response set feeling_relax_breath_littleE_reason='我更想有个音频引导我' where `user_info_id` ='" + userid + "' and `user_result_id` = '" + result_id + "' limit 1;"
            common.connectmysql(sql)
        except:
            dispatcher.utter_message(text='机器人错误 错误码0x050')
            return [UserUtteranceReverted()]
        finally:
            cursor.close()
            conn.close()
        dispatcher.utter_message(text='音频指引的确很有作用。')
        dispatcher.utter_message(text='阅读指示的同时专注于自己的呼吸，一次就能进步很多。')
        dispatcher.utter_message(text='如果你愿意，我们可以试试有口头指示的正念冥想。', buttons=[
            {'payload': '/button_part14_1_5_choose_6', 'title': '好呀，来试试吧~', 'life': 1},
            {'payload': '/button_part14_1_12_choose_1', 'title': '现在不想尝试', 'life': 1}, ])
        return []


class part14_1_4_choose_6(Action):
    def name(self) -> Text:
        return "action_part14_1_4_choose_6"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='干得好。 让我们再次吸气，慢慢数到三……然后保持住再数到三，在停顿时注意你的心跳。', buttons=[
            {'payload': '/button_part14_1_5_choose_7', 'title': '保持住呼吸……', 'life': 1}, ])
        return []


class part14_1_5_choose_1(Action):
    def name(self) -> Text:
        return "action_part14_1_5_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='感谢你今天花时间保持专注的努力哦！')
        dispatcher.utter_message(text='你做的超棒的💪', buttons=[
            {'payload': '/button_part14_1_6_choose_1', 'title': '谢谢~~👍', 'life': 1}, ])
        return []


class part14_1_5_choose_2(Action):
    def name(self) -> Text:
        return "action_part14_1_5_choose_2"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='只需点击屏幕底部的工具，它应该就在那里', buttons=[
            {'payload': '/button_part14_1_5_choose_3', 'title': '知道啦', 'life': 1}, ])
        return []


class part14_1_5_choose_3(Action):
    def name(self) -> Text:
        return "action_part14_1_5_choose_3"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        userid = tracker.current_state()['sender_id']
        sql = "update `user_result` set `is_end` = 1,end_time=now() where `user_info_id`='" + userid + "' and `topic_type` = 3 and `is_end` = 0 order by create_time desc limit 1;"
        common.connectmysql(sql)
        dispatcher.utter_message(text='你已完成当天的实验流程')
        dispatcher.utter_message(text='照顾好自己哟，下次再见！', buttons=[
            {'payload': '/greet', 'title': '拜拜~', 'life': 1}, ])
        return []


class part14_1_5_choose_4(Action):
    def name(self) -> Text:
        return "action_part14_1_5_choose_4"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='当然啦！你练习得越多，就越容易保持专注。正念呼吸就像肌肉一样。 通过坚持锻炼，它会变得越来越强壮 ', buttons=[
            {'payload': '/button_part14_1_6_choose_2', 'title': '我明白了', 'life': 1}, ])
        return []


class part14_1_5_choose_5(Action):
    def name(self) -> Text:
        return "action_part14_1_5_choose_5"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='你练习得越多，就越容易保持专注。正念呼吸就像肌肉一样。 通过坚持锻炼，它会变得越来越强壮', buttons=[
            {'payload': '/button_part14_1_6_choose_2', 'title': '我明白了', 'life': 1}, ])
        return []


class part14_1_5_choose_6(Action):
    def name(self) -> Text:
        return "action_part14_1_5_choose_6"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='首先，你需要适应并选择一个位置。 ', buttons=[
            {'payload': '/button_part14_1_6_choose_3', 'title': '我想要躺下', 'life': 1},
            {'payload': '/button_part14_1_6_choose_4', 'title': '我想坐着', 'life': 1}, ])
        return []


class part14_1_5_choose_7(Action):
    def name(self) -> Text:
        return "action_part14_1_5_choose_7"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='现在，呼气，慢慢数到四。当空气离开你的身体时，感受它的释放。如果你感觉良好，你可以在呼气时轻轻地哼唱或叹气。。', buttons=[
            {'payload': '/button_part14_1_6_choose_5', 'title': '呼气……', 'life': 1}, ])
        return []


class part14_1_6_choose_1(Action):
    def name(self) -> Text:
        return "action_part14_1_6_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        userid = tracker.current_state()['sender_id']
        sql = "update `user_result` set `is_end` = 1,end_time=now() where `user_info_id`='" + userid + "' and `topic_type` = 3 and `is_end` = 0 order by create_time desc limit 1;"
        common.connectmysql(sql)
        dispatcher.utter_message(text='你已完成当天的实验流程')
        dispatcher.utter_message(text='照顾好你自己~我已经开始期待起我们的下一次聊天了！ ', buttons=[
            {'payload': '/greet', 'title': '拜拜~', 'life': 1}, ])
        return []


class part14_1_6_choose_2(Action):
    def name(self) -> Text:
        return "action_part14_1_6_choose_2"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='不过在这期间，我知道你的感觉可能不是很好', buttons=[
            {'payload': '/button_part2_1_choose_1', 'title': '是的', 'life': 1},
            {'payload': '/button_part14_1_7_choose_1', 'title': '我想要试试另一种放松方式', 'life': 1},
            {'payload': '/button_part14_1_4_choose_2', 'title': '我暂时不想做了', 'life': 1}, ])
        return []


class part14_1_6_choose_3(Action):
    def name(self) -> Text:
        return "action_part14_1_6_choose_3"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='好的。确保你的腿放松。你可以把手放在身体两侧或折叠在一起放在你的肚子上 ', buttons=[
            {'payload': '/button_part14_1_7_choose_2', 'title': '好的', 'life': 1},
            {'payload': '/button_part14_1_7_choose_3', 'title': '我躺在哪里比较好呢', 'life': 1}, ])
        return []


class part14_1_6_choose_4(Action):
    def name(self) -> Text:
        return "action_part14_1_6_choose_4"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='确保你的背部挺直。你可以想象一根绳子从你的头顶伸出，有人轻轻地拉着它 。', buttons=[
            {'payload': '/button_part14_1_7_choose_4', 'title': '我坐好啦', 'life': 1}, ])
        return []


class part14_1_6_choose_5(Action):
    def name(self) -> Text:
        return "action_part14_1_6_choose_5"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='好的，最后一次呼吸。让我们吸气数到三……然后屏住数到三，放松你的肩膀，胸部保持饱满圆润。', buttons=[
            {'payload': '/button_part14_1_7_choose_5', 'title': '保持呼吸……', 'life': 1}, ])
        return []


class part14_1_7_choose_1(Action):
    def name(self) -> Text:
        return "action_part14_1_7_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='当然。让我们尝试一个工具来帮助你重新连接你的五种感官。这是一种很好的方式来从你可能的感受中找到分心和放松 ', buttons=[
            {'payload': '/button_part15_1_1_choose_1', 'title': '好的', 'life': 1}, ])
        return []


class part14_1_7_choose_2(Action):
    def name(self) -> Text:
        return "action_part14_1_7_choose_2"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='你可以闭上眼睛专注于录音，也可以睁大眼睛将注意力放在视频中的图像上 ', buttons=[
            {'payload': '/button_part14_1_8_choose_1', 'title': '我想要睁着眼睛', 'life': 1},
            {'payload': '/button_part14_1_8_choose_2', 'title': '我想要闭上眼睛', 'life': 1}, ])
        return []


class part14_1_7_choose_3(Action):
    def name(self) -> Text:
        return "action_part14_1_7_choose_3"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='你可以躺在地板上、床上或沙发上。任何对你来说最舒服的地方都可以。', buttons=[
            {'payload': '/button_part14_1_7_choose_2', 'title': '好的', 'life': 1},
            {'payload': '/button_part14_1_8_choose_3', 'title': '我要躺多长时间呀？', 'life': 1}, ])
        return []


class part14_1_7_choose_4(Action):
    def name(self) -> Text:
        return "action_part14_1_7_choose_4"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='将双脚放在地板上。您可以将手放在大腿上，也可以将手轻轻放在膝盖上 ', buttons=[
            {'payload': '/button_part14_1_7_choose_2', 'title': '好', 'life': 1}, ])
        return []


class part14_1_7_choose_5(Action):
    def name(self) -> Text:
        return "action_part14_1_7_choose_5"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='现在，呼气，慢慢数到四。当你呼气时，想象所有的担心、紧张或压力都离开了你的身体。随着你的肩膀和胸部放松，让它慢慢消失。', buttons=[
            {'payload': '/button_part14_1_2_choose_1', 'title': '好的，呼气……', 'life': 1}, ])
        return []


class part14_1_8_choose_1(Action):
    def name(self) -> Text:
        return "action_part14_1_8_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='好的，按下播放键，在你看图像时放松你的眼睛。当你完成时告诉我', buttons=[
            {'payload': '/button_part14_1_9_choose_1', 'title': '我完成了', 'life': 1}, ], json_message={
            "module_type": 2,
            "video": "mindfulness", })
        return []


class part14_1_8_choose_2(Action):
    def name(self) -> Text:
        return "action_part14_1_8_choose_2"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='好的，按下录音上的播放键，然后轻轻闭上眼睛。完成后告诉我', buttons=[
            {'payload': '/button_part14_1_9_choose_1', 'title': '我完成了', 'life': 1}, ], json_message={
            "module_type": 2,
            "video": "mindfulness", })
        return []


class part14_1_8_choose_3(Action):
    def name(self) -> Text:
        return "action_part14_1_8_choose_3"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='大约3分钟。', buttons=[
            {'payload': '/button_part14_1_7_choose_2', 'title': '好的', 'life': 1}, ])
        return []


class part14_1_9_choose_1(Action):
    def name(self) -> Text:
        return "action_part14_1_9_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='你现在感觉怎么样？', buttons=[
            {'payload': '/button_part14_1_10_choose_1', 'title': '不错', 'life': 1},
            {'payload': '/button_part14_1_10_choose_2', 'title': '没啥变化', 'life': 1},
            {'payload': '/button_part14_1_10_choose_3', 'title': '更不好了', 'life': 1}, ])
        return []


class part14_1_10_choose_1(Action):
    def name(self) -> Text:
        return "action_part14_1_10_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        userid = tracker.current_state()['sender_id']
        conn = common.POOL.connection(shareable=False)
        cursor = conn.cursor()
        try:
            cursor.execute(
                "Select * from `user_result` where `user_info_id` = '" + userid + "' and `is_end` = 0 and `topic_type` = 3 order by create_time desc limit 1;")
            x = cursor.fetchone()
            result_id = x[0]
            sql = "update user_tools_response set feeling_relax_breath_video='不错' where `user_info_id` ='" + userid + "' and `user_result_id` = '" + result_id + "' limit 1;"
            common.connectmysql(sql)
        except:
            dispatcher.utter_message(text='机器人错误 错误码0x050')
            return [UserUtteranceReverted()]
        finally:
            cursor.close()
            conn.close()
        dispatcher.utter_message(text='太棒啦。将注意力集中在图像上是一项很难练习的技能。我很高兴听到你的努力收获了回报', buttons=[
            {'payload': '/button_part14_1_11_choose_1', 'title': '谢谢~', 'life': 1}, ])
        return []


class part14_1_10_choose_2(Action):
    def name(self) -> Text:
        return "action_part14_1_10_choose_2"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        userid = tracker.current_state()['sender_id']
        conn = common.POOL.connection(shareable=False)
        cursor = conn.cursor()
        try:
            cursor.execute(
                "Select * from `user_result` where `user_info_id` = '" + userid + "' and `is_end` = 0 and `topic_type` = 3 order by create_time desc limit 1;")
            x = cursor.fetchone()
            result_id = x[0]
            sql = "update user_tools_response set feeling_relax_breath_video='没啥变化' where `user_info_id` ='" + userid + "' and `user_result_id` = '" + result_id + "' limit 1;"
            common.connectmysql(sql)
        except:
            dispatcher.utter_message(text='机器人错误 错误码0x050')
            return [UserUtteranceReverted()]
        finally:
            cursor.close()
            conn.close()
        dispatcher.utter_message(text='我知道，你想感觉更好一些。但其实，感觉相同并不是一个不好的结果。 ', buttons=[
            {'payload': '/button_part14_1_11_choose_2', 'title': '好的', 'life': 1}, ])
        return []


class part14_1_10_choose_3(Action):
    def name(self) -> Text:
        return "action_part14_1_10_choose_3"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        userid = tracker.current_state()['sender_id']
        conn = common.POOL.connection(shareable=False)
        cursor = conn.cursor()
        try:
            cursor.execute(
                "Select * from `user_result` where `user_info_id` = '" + userid + "' and `is_end` = 0 and `topic_type` = 3 order by create_time desc limit 1;")
            x = cursor.fetchone()
            result_id = x[0]
            sql = "update user_tools_response set feeling_relax_breath_video='更不好了' where `user_info_id` ='" + userid + "' and `user_result_id` = '" + result_id + "' limit 1;"
            common.connectmysql(sql)
        except:
            dispatcher.utter_message(text='机器人错误 错误码0x050')
            return [UserUtteranceReverted()]
        finally:
            cursor.close()
            conn.close()
        dispatcher.utter_message(text='天呐，听到你感觉更糟，我也有些难过了。我想到一些情况会导致这个方法不起作用，你想听听吗？ ', buttons=[
            {'payload': '/button_part14_1_11_choose_3', 'title': '让我们从常见的这些开始', 'life': 1},
            {'payload': '/button_part14_1_12_choose_1', 'title': '我不想继续了', 'life': 1}, ])
        return []


class part14_1_11_choose_1(Action):
    def name(self) -> Text:
        return "action_part14_1_11_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='我还想说的是，有时会走神也是完全可以的。练习的好处就在于可以学着去把你的注意力吸引回来。就像是健身时做的肱二头肌弯举一样💪', buttons=[
            {'payload': '/button_part14_1_12_choose_1', 'title': '哦~我明白了', 'life': 1},
            {'payload': '/button_part14_1_12_choose_2', 'title': '肱二头肌弯举？', 'life': 1}, ])
        return []


class part14_1_11_choose_2(Action):
    def name(self) -> Text:
        return "action_part14_1_11_choose_2"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(
            text='这种类型的冥想需要大量练习，当我们已经沮丧时，没有感到更糟已经是一个正向的结果啦。此外，有时好处实际上在于多多练习而不是当下的感受 。两脚兽总跟我说一句话：授人以鱼不如授人以渔。', buttons=[
                {'payload': '/button_part14_1_11_choose_1', 'title': '太对了', 'life': 1},
                {'payload': '/button_part14_1_11_choose_1', 'title': '有道理', 'life': 1}, ])
        return []


class part14_1_11_choose_3(Action):
    def name(self) -> Text:
        return "action_part14_1_11_choose_3"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='让我们从常见的这些开始：', buttons=[
            {'payload': '/button_part14_1_12_choose_3', 'title': '我周围太乱，太吵了', 'life': 1},
            {'payload': '/button_part14_1_12_choose_4', 'title': '我没有办法集中注意力', 'life': 1},
            {'payload': '/button_part14_1_12_choose_5', 'title': '我不够放松', 'life': 1},
            {'payload': '/button_part14_1_12_choose_6', 'title': '我不喜欢这个音频', 'life': 1},
            {'payload': '/button_part14_1_12_choose_7', 'title': '有好几个情况我都符合', 'life': 1}, ])
        return []


class part14_1_12_choose_1(Action):
    def name(self) -> Text:
        return "action_part14_1_12_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        userid = tracker.current_state()['sender_id']
        sql = "update `user_result` set `is_end` = 1,end_time=now() where `user_info_id`='" + userid + "' and `topic_type` = 3 and `is_end` = 0 order by create_time desc limit 1;"
        common.connectmysql(sql)
        dispatcher.utter_message(text='你已完成当天的实验流程')
        dispatcher.utter_message(text='好的，我希望你有一个愉快的休息日，希望下次我们再在一起聊天。现在再见啦', buttons=[
            {'payload': '/greet', 'title': 'Bye', 'life': 1}, ])
        return []


class part14_1_12_choose_2(Action):
    def name(self) -> Text:
        return "action_part14_1_12_choose_2"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='对呀，你看，你在健身时做的肱二头肌弯举越多，重量越重，你就会变得越强壮。注意力也是一样的 ', buttons=[
            {'payload': '/button_part14_1_13_choose_1', 'title': '哦？', 'life': 1}, ])
        return []


class part14_1_12_choose_3(Action):
    def name(self) -> Text:
        return "action_part14_1_12_choose_3"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        userid = tracker.current_state()['sender_id']
        conn = common.POOL.connection(shareable=False)
        cursor = conn.cursor()
        try:
            cursor.execute(
                "Select * from `user_result` where `user_info_id` = '" + userid + "' and `is_end` = 0 and `topic_type` = 3 order by create_time desc limit 1;")
            x = cursor.fetchone()
            result_id = x[0]
            sql = "update user_tools_response set feeling_relax_breath_video_reason='我周围太乱，太吵了' where `user_info_id` ='" + userid + "' and `user_result_id` = '" + result_id + "' limit 1;"
            common.connectmysql(sql)
        except:
            dispatcher.utter_message(text='机器人错误 错误码0x050')
            return [UserUtteranceReverted()]
        finally:
            cursor.close()
            conn.close()
        dispatcher.utter_message(text='是的，当我们周围熙熙攘攘时，很难集中注意力。找到一个相对安静的地方，即使是 5 分钟，也会让世界变得不同 ', buttons=[
            {'payload': '/button_part14_1_11_choose_1', 'title': '是的', 'life': 1}, ])
        return []


class part14_1_12_choose_4(Action):
    def name(self) -> Text:
        return "action_part14_1_12_choose_4"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        userid = tracker.current_state()['sender_id']
        conn = common.POOL.connection(shareable=False)
        cursor = conn.cursor()
        try:
            cursor.execute(
                "Select * from `user_result` where `user_info_id` = '" + userid + "' and `is_end` = 0 and `topic_type` = 3 order by create_time desc limit 1;")
            x = cursor.fetchone()
            result_id = x[0]
            sql = "update user_tools_response set feeling_relax_breath_video_reason='我没有办法集中注意力' where `user_info_id` ='" + userid + "' and `user_result_id` = '" + result_id + "' limit 1;"
            common.connectmysql(sql)
        except:
            dispatcher.utter_message(text='机器人错误 错误码0x050')
            return [UserUtteranceReverted()]
        finally:
            cursor.close()
            conn.close()
        dispatcher.utter_message(
            text='是的，有时我结束的时候会想到晚餐吃什么，或者我是不是午饭的时候是不是把油滴在我的屏幕上了，很难专注于任务本身。不过，好消息是，这种集中注意力的晃动和交织都是练习和学习的一部分', buttons=[
                {'payload': '/button_part14_1_11_choose_1', 'title': '哈哈哈', 'life': 1},
                {'payload': '/button_part14_1_11_choose_1', 'title': '哦~那很好呀', 'life': 1}, ])
        return []


class part14_1_12_choose_5(Action):
    def name(self) -> Text:
        return "action_part14_1_12_choose_5"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        userid = tracker.current_state()['sender_id']
        conn = common.POOL.connection(shareable=False)
        cursor = conn.cursor()
        try:
            cursor.execute(
                "Select * from `user_result` where `user_info_id` = '" + userid + "' and `is_end` = 0 and `topic_type` = 3 order by create_time desc limit 1;")
            x = cursor.fetchone()
            result_id = x[0]
            sql = "update user_tools_response set feeling_relax_breath_video_reason='有好几个情况我都符合' where `user_info_id` ='" + userid + "' and `user_result_id` = '" + result_id + "' limit 1;"
            common.connectmysql(sql)
        except:
            dispatcher.utter_message(text='机器人错误 错误码0x050')
            return [UserUtteranceReverted()]
        finally:
            cursor.close()
            conn.close()
        dispatcher.utter_message(text='是啊，当我们心情低落或不高兴的时候，要停止纷乱的思绪或者放松自己就很难。 我发现我练习的时间越长，我就越放松 ', buttons=[
            {'payload': '/button_part14_1_11_choose_1', 'title': '我懂啦', 'life': 1},
            {'payload': '/button_part14_1_11_choose_1', 'title': '不轻言放弃！', 'life': 1}, ])
        return []


class part14_1_12_choose_6(Action):
    def name(self) -> Text:
        return "action_part14_1_12_choose_6"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        userid = tracker.current_state()['sender_id']
        conn = common.POOL.connection(shareable=False)
        cursor = conn.cursor()
        try:
            cursor.execute(
                "Select * from `user_result` where `user_info_id` = '" + userid + "' and `is_end` = 0 and `topic_type` = 3 order by create_time desc limit 1;")
            x = cursor.fetchone()
            result_id = x[0]
            sql = "update user_tools_response set feeling_relax_breath_video_reason='我不喜欢这个音频' where `user_info_id` ='" + userid + "' and `user_result_id` = '" + result_id + "' limit 1;"
            common.connectmysql(sql)
        except:
            dispatcher.utter_message(text='机器人错误 错误码0x050')
            return [UserUtteranceReverted()]
        finally:
            cursor.close()
            conn.close()
        dispatcher.utter_message(text='很高兴知道你的想法，我会把你的意见告诉我的两脚兽朋友的，看看他们能做些什么', buttons=[
            {'payload': '/button_part14_1_11_choose_1', 'title': '好的', 'life': 1}, ])
        return []


class part14_1_12_choose_7(Action):
    def name(self) -> Text:
        return "action_part14_1_12_choose_7"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        userid = tracker.current_state()['sender_id']
        conn = common.POOL.connection(shareable=False)
        cursor = conn.cursor()
        try:
            cursor.execute(
                "Select * from `user_result` where `user_info_id` = '" + userid + "' and `is_end` = 0 and `topic_type` = 3 order by create_time desc limit 1;")
            x = cursor.fetchone()
            result_id = x[0]
            sql = "update user_tools_response set feeling_relax_breath_video_reason='我周围太乱，太吵了' where `user_info_id` ='" + userid + "' and `user_result_id` = '" + result_id + "' limit 1;"
            common.connectmysql(sql)
        except:
            dispatcher.utter_message(text='机器人错误 错误码0x050')
            return [UserUtteranceReverted()]
        finally:
            cursor.close()
            conn.close()
        dispatcher.utter_message(text='是的，这些都是导致这个过程困难的正当理由，但不要担心我的朋友，只要勤加练习，就会变得... ', buttons=[
            {'payload': '/button_part14_1_11_choose_1', 'title': '越来越好😊', 'life': 1}, ])
        return []


class part14_1_13_choose_1(Action):
    def name(self) -> Text:
        return "action_part14_1_13_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='你将注意力集中在当下的次数越多，尤其是在不容易集中注意力的时候，你的正念意识就会变得越协调和敏锐 ', buttons=[
            {'payload': '/button_part14_1_12_choose_1', 'title': '我明白了', 'life': 1}, ])
        return []


class part15_1_1_choose_1(Action):
    def name(self) -> Text:
        return "action_part15_1_1_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='让我们通过调整你的五种感官来帮助你找到一些稳定性。一个小提醒：这个练习可能无法解决您正在处理的问题。但它可以帮助你在面对问题时更加从容', buttons=[
            {'payload': '/button_part15_1_2_choose_1', 'title': '好呀', 'life': 1}, ])
        return []


class part15_1_2_choose_1(Action):
    def name(self) -> Text:
        return "action_part15_1_2_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='你想要关注哪一个感官？', buttons=[
            {'payload': '/button_part15_1_3_choose_1', 'title': '视觉', 'life': 1},
            {'payload': '/button_part15_1_3_choose_2', 'title': '听觉', 'life': 1},
            {'payload': '/button_part15_1_3_choose_3', 'title': '嗅觉', 'life': 1},
            {'payload': '/button_part15_1_3_choose_4', 'title': '味觉', 'life': 1},
            {'payload': '/button_part15_1_3_choose_5', 'title': '触觉', 'life': 1},
            {'payload': '/button_part15_1_3_choose_6', 'title': '我做完五感放松了', 'life': 1}, ])
        return []


class part15_1_3_choose_1(Action):
    def name(self) -> Text:
        return "action_part15_1_3_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        url = 'https://obs-e912.obs.cn-east-2.myhuaweicloud.com/zy_xm/image/rasa_photo_2021_08_16/relax/five_senses_sight~1.mp4'
        dispatcher.utter_message(text='好的，仔细看看这张图片。让任何想法或烦恼都烟消云散——只专注于它移动和颜色变化的方式', json_message={
            "module_type": 2,
            "video": "five_senses_sight", }, buttons=[
            {'payload': '/button_part15_1_4_choose_1', 'title': '好的', 'life': 1}, ])
        return []


class part15_1_3_choose_2(Action):
    def name(self) -> Text:
        return "action_part15_1_3_choose_2"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='好的。 我想让你把注意力集中在你周围的声音上，无论你在哪里')
        dispatcher.utter_message(text='你可能会听到鸟鸣、谈话、汽车的声音或者音乐声…… ', buttons=[
            {'payload': '/button_part15_1_4_choose_2', 'title': '下一步呢？', 'life': 1},
            {'payload': '/button_part15_1_4_choose_3', 'title': '我什么都听不到', 'life': 1}, ])
        return []


class part15_1_3_choose_3(Action):
    def name(self) -> Text:
        return "action_part15_1_3_choose_3"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='首先，试着找一个有舒缓、愉悦气味的物品')
        dispatcher.utter_message(text='你可以选择一束香草、一支香薰蜡烛或一些肥皂', buttons=[
            {'payload': '/button_part15_1_4_choose_4', 'title': '还有其他的吗？', 'life': 1},
            {'payload': '/button_part15_1_4_choose_5', 'title': '好的', 'life': 1},
            {'payload': '/button_part15_1_4_choose_6', 'title': '我找不到什么东西', 'life': 1}, ])
        return []


class part15_1_3_choose_4(Action):
    def name(self) -> Text:
        return "action_part15_1_3_choose_4"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='对于味觉，让我们先喝一杯舒缓的饮料——比如茶、热可可或果汁', buttons=[
            {'payload': '/button_part15_1_4_choose_7', 'title': '好的', 'life': 1},
            {'payload': '/button_part15_1_4_choose_8', 'title': '找不到好喝的，有其他办法吗？', 'life': 1},
            {'payload': '/button_part15_1_4_choose_8', 'title': '我更想吃个东西', 'life': 1}, ])
        return []


class part15_1_3_choose_5(Action):
    def name(self) -> Text:
        return "action_part15_1_3_choose_5"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='好的。我希望你选择一个在你身旁的让你感到舒服的东西——比如毯子、光滑的鹅卵石或抱枕之类的。', buttons=[
            {'payload': '/button_part15_1_4_choose_9', 'title': '嗯嗯，拿到啦', 'life': 1},
            {'payload': '/button_part15_1_4_choose_10', 'title': '没有这些哎，能用其他的东西吗？', 'life': 1}, ])
        return []


class part15_1_3_choose_6(Action):
    def name(self) -> Text:
        return "action_part15_1_3_choose_6"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='你现在觉得怎么样呀？', buttons=[
            {'payload': '/button_part15_1_4_choose_11', 'title': '更好了', 'life': 1},
            {'payload': '/button_part15_1_5_choose_12', 'title': '更糟糕了', 'life': 1},
            {'payload': '/button_part15_1_4_choose_12', 'title': '没啥变化', 'life': 1}, ])
        return []


class part15_1_4_choose_1(Action):
    def name(self) -> Text:
        return "action_part15_1_4_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='如果你的思绪飘走了，轻轻地引导你的注意力重新回到图像上。')
        dispatcher.utter_message(text='这种徘徊和引导意味着你已经处在放松状态中了', buttons=[
            {'payload': '/button_part15_1_5_choose_1', 'title': '我明白啦', 'life': 1}, ])
        return []


class part15_1_4_choose_2(Action):
    def name(self) -> Text:
        return "action_part15_1_4_choose_2"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='当你收听这些声音时，注意任何出现的想法——关于你的感受，或者关于你以后需要做什么')
        dispatcher.utter_message(text='如果你走神了，轻轻地将你的注意力引导回到你的听觉上')
        dispatcher.utter_message(text='不加判断地经历你的想法，让它们飘走 ', buttons=[
            {'payload': '/button_part15_1_5_choose_2', 'title': '好的', 'life': 1}, ])
        return []


class part15_1_4_choose_3(Action):
    def name(self) -> Text:
        return "action_part15_1_4_choose_3"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='没关系。 尽你所能去感受沉默，注意它是什么样的。你甚至可以想出一个词来形容它——比如凉爽、厚重、舒适或柔软 ', buttons=[
            {'payload': '/button_part15_1_5_choose_3', 'title': '我明白啦', 'life': 1}, ])
        return []


class part15_1_4_choose_4(Action):
    def name(self) -> Text:
        return "action_part15_1_4_choose_4"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='你可以拿起你最喜欢的乳液，找一堆干净的衣服，或者煮一杯新鲜的咖啡。我喜欢在烤箱里放一些饼干面团，等待气味充满我的整个厨房🍪', buttons=[
            {'payload': '/button_part15_1_4_choose_5', 'title': '好的，我找到一个啦', 'life': 1},
            {'payload': '/button_part15_1_4_choose_6', 'title': '我找不到什么东西', 'life': 1}, ])
        return []


class part15_1_4_choose_5(Action):
    def name(self) -> Text:
        return "action_part15_1_4_choose_5"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='当你准备好你的好闻的东西时告诉我', buttons=[
            {'payload': '/button_part15_1_5_choose_4', 'title': '我准备好啦', 'life': 1}, ])
        return []


class part15_1_4_choose_6(Action):
    def name(self) -> Text:
        return "action_part15_1_4_choose_6"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='没关系。 现在，让我们专注于你周围的环境')
        dispatcher.utter_message(text='专注于你此时此地可以注意到的气味', buttons=[
            {'payload': '/button_part15_1_5_choose_5', 'title': '好的', 'life': 1},
            {'payload': '/button_part15_1_5_choose_6', 'title': '有啥例子吗？', 'life': 1}, ])
        return []


class part15_1_4_choose_7(Action):
    def name(self) -> Text:
        return "action_part15_1_4_choose_7"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='很好！当你拿到饮品的时候告诉我', buttons=[
            {'payload': '/button_part15_1_5_choose_7', 'title': '我拿到我的饮品了', 'life': 1}, ])
        return []


class part15_1_4_choose_8(Action):
    def name(self) -> Text:
        return "action_part15_1_4_choose_8"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='好的~薄荷糖、一块口香糖，或者其他你喜欢的零食怎么样？', buttons=[
            {'payload': '/button_part15_1_5_choose_8', 'title': '好的', 'life': 1},
            {'payload': '/button_part15_1_5_choose_9', 'title': '我没找到啥能吃的', 'life': 1}, ])
        return []


class part15_1_4_choose_9(Action):
    def name(self) -> Text:
        return "action_part15_1_4_choose_9"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='把你觉得舒适的物品放到触手可及的位置。当你准备好时告诉我 ', buttons=[
            {'payload': '/button_part15_1_5_choose_10', 'title': '我准备好了', 'life': 1}, ])
        return []


class part15_1_4_choose_10(Action):
    def name(self) -> Text:
        return "action_part15_1_4_choose_10"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='当然可以。你可以抚摸或梳理你的头发，或者拥抱宠物或毛绒动物。你也可以试着搓搓双手，或者触摸柔软的衣服 ', buttons=[
            {'payload': '/button_part15_1_4_choose_9', 'title': '好的', 'life': 1}, ])
        return []


class part15_1_4_choose_11(Action):
    def name(self) -> Text:
        return "action_part15_1_4_choose_11"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        userid = tracker.current_state()['sender_id']
        conn = common.POOL.connection(shareable=False)
        cursor = conn.cursor()
        try:
            cursor.execute(
                "Select * from `user_result` where `user_info_id` = '" + userid + "' and `is_end` = 0 and `topic_type` = 3 order by create_time desc limit 1;")
            x = cursor.fetchone()
            result_id = x[0]
            sql = "update user_tools_response set feeling_five_senses='更好了' where `user_info_id` ='" + userid + "' and `user_result_id` = '" + result_id + "' limit 1;"
            common.connectmysql(sql)
        except:
            dispatcher.utter_message(text='机器人错误 错误码0x050')
            return [UserUtteranceReverted()]
        finally:
            cursor.close()
            conn.close()
        dispatcher.utter_message(text='很开心能听到你感觉更好啦专注于您的五种感官可以帮助您在事情变得不堪重负时感到更加放松和踏实,当你的身体平静时，你的头脑可能也会开始感觉更清晰',
                                 buttons=[
                                     {'payload': '/button_part15_1_5_choose_11', 'title': '好的', 'life': 1}, ])
        return []


class part15_1_4_choose_12(Action):
    def name(self) -> Text:
        return "action_part15_1_4_choose_12"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        userid = tracker.current_state()['sender_id']
        conn = common.POOL.connection(shareable=False)
        cursor = conn.cursor()
        try:
            cursor.execute(
                "Select * from `user_result` where `user_info_id` = '" + userid + "' and `is_end` = 0 and `topic_type` = 3 order by create_time desc limit 1;")
            x = cursor.fetchone()
            result_id = x[0]
            sql = "update user_tools_response set feeling_five_senses='没啥变化' where `user_info_id` ='" + userid + "' and `user_result_id` = '" + result_id + "' limit 1;"
            common.connectmysql(sql)
        except:
            dispatcher.utter_message(text='机器人错误 错误码0x050')
            return [UserUtteranceReverted()]
        finally:
            cursor.close()
            conn.close()
        dispatcher.utter_message(text='我知道了其实，感觉相同其实是一件很好的事情这个工具的目的是帮助你找到一些稳定性，并防止你的感觉更糟糕。', buttons=[
            {'payload': '/button_part15_1_5_choose_12', 'title': '好的', 'life': 1}, ])
        return []


class part15_1_5_choose_1(Action):
    def name(self) -> Text:
        return "action_part15_1_5_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        url = 'https://obs-e912.obs.cn-east-2.myhuaweicloud.com/zy_xm/image/rasa_photo_2021_08_16/relax/five_senses_sight~1.mp4'
        dispatcher.utter_message(text='继续看图像做五次缓慢而稳定的呼吸。让我知道你什么时候完成 ', json_message={
            "module_type": 2,
            "video": "five_senses_sight", }, buttons=[
            {'payload': '/button_part15_1_2_choose_1', 'title': '我做完啦', 'life': 1}, ])
        return []


class part15_1_5_choose_2(Action):
    def name(self) -> Text:
        return "action_part15_1_5_choose_2"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='现在，让我们注意这些声音有何不同识别你能听到的最大声音......还有你能听到的最小声音', buttons=[
            {'payload': '/button_part15_1_6_choose_1', 'title': '好的……', 'life': 1}, ])
        return []


class part15_1_5_choose_3(Action):
    def name(self) -> Text:
        return "action_part15_1_5_choose_3"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(
            text='当你安静地坐着时，可能会出现一些想法——关于你的感受，或者关于你以后需要做什么。如果你的思绪走神，轻轻地将你的注意力引导回你的听力。不加判断地注意你的想法，并允许它们飘走 ', buttons=[
                {'payload': '/button_part15_1_7_choose_1', 'title': '好的', 'life': 1}, ])
        return []


class part15_1_5_choose_4(Action):
    def name(self) -> Text:
        return "action_part15_1_5_choose_4"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='如果可以，把它举到你的鼻子下，注意它的气味。选择一个词来描述它。它可能是甜的、辣的、烟熏的或新鲜的 ', buttons=[
            {'payload': '/button_part15_1_6_choose_2', 'title': '好的', 'life': 1}, ])
        return []


class part15_1_5_choose_5(Action):
    def name(self) -> Text:
        return "action_part15_1_5_choose_5"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='现在，我想让你把注意力集中在你能闻到的东西上 ', buttons=[
            {'payload': '/button_part15_1_5_choose_4', 'title': '好的', 'life': 1}, ])
        return []


class part15_1_5_choose_6(Action):
    def name(self) -> Text:
        return "action_part15_1_5_choose_6"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='如果你在外面，你可能会闻到树木、鲜花或刚割过的草的味道')
        dispatcher.utter_message(text='如果你在室内，你可能会闻到食物、宠物或某人的香水味 ', buttons=[
            {'payload': '/button_part15_1_5_choose_5', 'title': '哦~', 'life': 1}, ])
        return []


class part15_1_5_choose_7(Action):
    def name(self) -> Text:
        return "action_part15_1_5_choose_7"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='好的~现在喝一口你的饮品吧如果它没那么热的话，喝一口，在嘴里含一会儿', buttons=[
            {'payload': '/button_part15_1_6_choose_3', 'title': '好的', 'life': 1}, ])
        return []


class part15_1_5_choose_8(Action):
    def name(self) -> Text:
        return "action_part15_1_5_choose_8"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='太棒了！当你手头准备好了零食、薄荷糖或口香糖时，请告诉我', buttons=[
            {'payload': '/button_part15_1_6_choose_4', 'title': '我拿到了', 'life': 1}, ])
        return []


class part15_1_5_choose_9(Action):
    def name(self) -> Text:
        return "action_part15_1_5_choose_9"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='不用担心刷牙也可以在紧要关头起到作用', buttons=[
            {'payload': '/button_part15_1_6_choose_5', 'title': '好的，我现在可以刷牙', 'life': 1},
            {'payload': '/button_part15_1_6_choose_6', 'title': '我现在没法刷牙', 'life': 1}, ])
        return []


class part15_1_5_choose_10(Action):
    def name(self) -> Text:
        return "action_part15_1_5_choose_10"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='现在，伸手去感受它，专注于你的触觉。在它的表面上轻轻地移动你的手或指尖 ', buttons=[
            {'payload': '/button_part15_1_6_choose_7', 'title': '好……', 'life': 1}, ])
        return []


class part15_1_5_choose_11(Action):
    def name(self) -> Text:
        return "action_part15_1_5_choose_11"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='我已经把这个练习放在你的工具箱里，你可以随时使用它', buttons=[
            {'payload': '/button_part15_1_6_choose_8', 'title': '我知道啦', 'life': 1}, ])
        return []


class part15_1_5_choose_12(Action):
    def name(self) -> Text:
        return "action_part15_1_5_choose_12"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        userid = tracker.current_state()['sender_id']
        conn = common.POOL.connection(shareable=False)
        cursor = conn.cursor()
        try:
            cursor.execute(
                "Select * from `user_result` where `user_info_id` = '" + userid + "' and `is_end` = 0 and `topic_type` = 3 order by create_time desc limit 1;")
            x = cursor.fetchone()
            result_id = x[0]
            sql = "update user_tools_response set feeling_five_senses='更糟糕了' where `user_info_id` ='" + userid + "' and `user_result_id` = '" + result_id + "' limit 1;"
            common.connectmysql(sql)
        except:
            dispatcher.utter_message(text='机器人错误 错误码0x050')
            return [UserUtteranceReverted()]
        finally:
            cursor.close()
            conn.close()
        dispatcher.utter_message(text='如果你愿意，我们可以尝试另一种工具，它可能会给你带来更多缓解。它会引导你进行一些温和的肌肉放松，帮助你的情绪更加稳定 ', buttons=[
            {'payload': '/button_part15_1_6_choose_9', 'title': '好呀，我想尝试一下', 'life': 1},
            {'payload': '/button_part15_1_6_choose_10', 'title': '今天不想继续了', 'life': 1}, ])
        return []


class part15_1_6_choose_1(Action):
    def name(self) -> Text:
        return "action_part15_1_6_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='然后，确定你能听到的最高音调......和最低音调', buttons=[
            {'payload': '/button_part15_1_7_choose_1', 'title': '好', 'life': 1}, ])
        return []


class part15_1_6_choose_2(Action):
    def name(self) -> Text:
        return "action_part15_1_6_choose_2"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='深吸一口气，数到四......然后呼气，数到四。当你呼吸时，继续专注于那种气味——注意它给你的感觉，或者它让你想起了什么 ', buttons=[
            {'payload': '/button_part15_1_7_choose_2', 'title': '嗯……', 'life': 1}, ])
        return []


class part15_1_6_choose_3(Action):
    def name(self) -> Text:
        return "action_part15_1_6_choose_3"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='感受液体的味道、温度和质地它可能是甜的、草木香的、温暖的或清爽的抓住这一刻真正沉浸其中', buttons=[
            {'payload': '/button_part15_1_7_choose_3', 'title': '好的', 'life': 1}, ])
        return []


class part15_1_6_choose_4(Action):
    def name(self) -> Text:
        return "action_part15_1_6_choose_4"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='现在，将口香糖或食物放入口中。尽可能缓慢、仔细地咀嚼 ', buttons=[
            {'payload': '/button_part15_1_7_choose_4', 'title': '好……', 'life': 1}, ])
        return []


class part15_1_6_choose_5(Action):
    def name(self) -> Text:
        return "action_part15_1_6_choose_5"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='太棒了！现在，当你拿到牙刷时告诉我', buttons=[
            {'payload': '/button_part15_1_7_choose_5', 'title': '拿到牙刷啦', 'life': 1}, ])
        return []


class part15_1_6_choose_6(Action):
    def name(self) -> Text:
        return "action_part15_1_6_choose_6"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='没关系！如果你手头没有零食、饮料或牙膏，这可能不是专注于品味的最佳时机。你是要继续下去，还是想要今天就结束？', buttons=[
            {'payload': '/button_part15_1_2_choose_1', 'title': '继续下去', 'life': 1},
            {'payload': '/button_part15_1_26_choose_1', 'title': '今天先结束吧', 'life': 1}, ])
        return []


class part15_1_6_choose_7(Action):
    def name(self) -> Text:
        return "action_part15_1_6_choose_7"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='注意当你触摸物体的不同部分时纹理是否发生变化。如果可以，把它放到你的脸上，注意它贴在你的脸颊和额头上的感觉 ', buttons=[
            {'payload': '/button_part15_1_7_choose_6', 'title': '好的', 'life': 1}, ])
        return []


class part15_1_6_choose_8(Action):
    def name(self) -> Text:
        return "action_part15_1_6_choose_8"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        userid = tracker.current_state()['sender_id']
        sql = "update `user_result` set `is_end` = 1,end_time=now() where `user_info_id`='" + userid + "' and `topic_type` = 3 and `is_end` = 0 order by create_time desc limit 1;"
        common.connectmysql(sql)
        dispatcher.utter_message(text='那期待下次再见啦拜拜~')
        dispatcher.utter_message(text='你已完成当天的实验流程')
        dispatcher.utter_message(text='照顾好自己哟，下次再见！', buttons=[
            {'payload': '/greet', 'title': '拜拜~', 'life': 1}, ])
        return []


class part15_1_6_choose_9(Action):
    def name(self) -> Text:
        return "action_part15_1_6_choose_9"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='让我们努力释放您体内的一些压力 ', buttons=[
            {'payload': '/button_part15_1_7_choose_7', 'title': '好的', 'life': 1}, ])
        return []


class part15_1_6_choose_10(Action):
    def name(self) -> Text:
        return "action_part15_1_6_choose_10"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        userid = tracker.current_state()['sender_id']
        sql = "update `user_result` set `is_end` = 1,end_time=now() where `user_info_id`='" + userid + "' and `topic_type` = 3 and `is_end` = 0 order by create_time desc limit 1;"
        common.connectmysql(sql)
        dispatcher.utter_message(text='好的~完全没有问题！')
        dispatcher.utter_message(text='你已完成当天的实验流程')
        dispatcher.utter_message(text='照顾好自己哟，下次再见！', buttons=[
            {'payload': '/greet', 'title': '拜拜~', 'life': 1}, ])
        return []


class part15_1_7_choose_1(Action):
    def name(self) -> Text:
        return "action_part15_1_7_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='最后，收听自己的呼吸声缓慢地深呼吸五次，如果可以的话，在吸气时聆听轻柔的气流……...还有呼气时的', buttons=[
            {'payload': '/button_part15_1_8_choose_1', 'title': '好啦，我做完啦', 'life': 1}, ])
        return []


class part15_1_7_choose_2(Action):
    def name(self) -> Text:
        return "action_part15_1_7_choose_2"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='当你吸气时，想象你正在以强烈、舒适或平静的方式呼吸。当你呼气时，你呼出的是担心、沮丧或其他任何困扰你的事情', buttons=[
            {'payload': '/button_part15_1_8_choose_2', 'title': '好', 'life': 1}, ])
        return []


class part15_1_7_choose_3(Action):
    def name(self) -> Text:
        return "action_part15_1_7_choose_3"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='当你啜饮时，注意你的呼吸进出你的鼻子')
        dispatcher.utter_message(text='专注于饮料的味道和呼吸的平稳节奏 ', buttons=[
            {'payload': '/button_part15_1_3_choose_6', 'title': '我做完啦', 'life': 1}, ])
        return []


class part15_1_7_choose_4(Action):
    def name(self) -> Text:
        return "action_part15_1_7_choose_4"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='专注于味道、温度和质地。它可能是光滑的、松脆的、咸的或甜的。抓住这一刻真正地沉浸其中 ', buttons=[
            {'payload': '/button_part15_1_8_choose_3', 'title': '好的', 'life': 1}, ])
        return []


class part15_1_7_choose_5(Action):
    def name(self) -> Text:
        return "action_part15_1_7_choose_5"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='现在，把豌豆大小的牙膏放在牙刷上。把它放进嘴里，开始刷牙', buttons=[
            {'payload': '/button_part15_1_8_choose_4', 'title': '好的', 'life': 1}, ])
        return []


class part15_1_7_choose_6(Action):
    def name(self) -> Text:
        return "action_part15_1_7_choose_6"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='当你抚摸并且感知它的时候，想出几个词来描述这个物体。它可能是光滑的、柔软的、玻璃状的或凹凸不平的。感受你触摸的东西带给你的感受', buttons=[
            {'payload': '/button_part15_1_8_choose_5', 'title': '深入感受……', 'life': 1},
            {'payload': '/button_part15_1_8_choose_6', 'title': '我能换个东西感受吗？', 'life': 1}, ])
        return []


class part15_1_7_choose_7(Action):
    def name(self) -> Text:
        return "action_part15_1_7_choose_7"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='小E想要提醒你：在这个练习中，你要收缩和放松不同的肌肉群,因此，如果你现在有哪里受伤了或者活动能力有限，做你能做的部分，跳过你不能做的就好。',
                                 buttons=[
                                     {'payload': '/button_part15_1_8_choose_7', 'title': '好哒', 'life': 1}, ])
        return []


class part15_1_8_choose_1(Action):
    def name(self) -> Text:
        return "action_part15_1_8_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='你还想再尝试一个感官吗？', buttons=[
            {'payload': '/button_part15_1_2_choose_1', 'title': '好呀', 'life': 1}, ])
        return []


class part15_1_8_choose_2(Action):
    def name(self) -> Text:
        return "action_part15_1_8_choose_2"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='慢慢享受你的时间你想持续多久都可以', buttons=[
            {'payload': '/button_part15_1_9_choose_1', 'title': '好的，我完成了', 'life': 1},
            {'payload': '/button_part15_1_9_choose_2', 'title': '我可以再试一次吗', 'life': 1}])
        return []


class part15_1_8_choose_3(Action):
    def name(self) -> Text:
        return "action_part15_1_8_choose_3"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='当你吃东西时，注意你的呼吸进出你的鼻子')
        dispatcher.utter_message(text='专注于食物的味道和呼吸的平稳节奏', buttons=[
            {'payload': '/button_part15_1_9_choose_3', 'title': '好的', 'life': 1}, ])
        return []


class part15_1_8_choose_4(Action):
    def name(self) -> Text:
        return "action_part15_1_8_choose_4"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='刷牙时，专注你的味觉。你可能会注意到甜味、薄荷味、清凉味或奶油味。抓住这一刻真正地沉浸其中', buttons=[
            {'payload': '/button_part15_1_9_choose_4', 'title': '好的……', 'life': 1}, ])
        return []


class part15_1_8_choose_5(Action):
    def name(self) -> Text:
        return "action_part15_1_8_choose_5"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='太棒啦，你还想再尝试一个感官吗？', buttons=[
            {'payload': '/button_part15_1_2_choose_1', 'title': '好呀', 'life': 1}, ])
        return []


class part15_1_8_choose_6(Action):
    def name(self) -> Text:
        return "action_part15_1_8_choose_6"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='当然可以啦！', buttons=[
            {'payload': '/button_part15_1_4_choose_9', 'title': '好的', 'life': 1}, ])
        return []


class part15_1_8_choose_7(Action):
    def name(self) -> Text:
        return "action_part15_1_8_choose_7"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='没问题首先，找到一个舒适的地方你可以坐在椅子上或躺在地板上——任何对你最有效的方法', buttons=[
            {'payload': '/button_part15_1_9_choose_5', 'title': '好了，我现在感觉很舒服', 'life': 1}, ])
        return []


class part15_1_9_choose_1(Action):
    def name(self) -> Text:
        return "action_part15_1_9_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='当我们经历这些感觉时，您可能会开始注意到一种平静感', buttons=[
            {'payload': '/button_part15_1_8_choose_1', 'title': '嗯嗯!', 'life': 1}, ])
        return []


class part15_1_9_choose_2(Action):
    def name(self) -> Text:
        return "action_part15_1_9_choose_2"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='当然可以！试着把你的注意力重新集中在你闻到的东西上。选择一个新词来描述它——它可以是泥土味、辛辣味、草本味或清洁味 ', buttons=[
            {'payload': '/button_part15_1_6_choose_2', 'title': '好的', 'life': 1}, ])
        return []


class part15_1_9_choose_3(Action):
    def name(self) -> Text:
        return "action_part15_1_9_choose_3"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='这一刻是关于与味觉的简单乐趣联系起来的。慢慢来，当你完成时告诉我 ', buttons=[
            {'payload': '/button_part15_1_3_choose_6', 'title': '我做完啦', 'life': 1}, ])
        return []


class part15_1_9_choose_4(Action):
    def name(self) -> Text:
        return "action_part15_1_9_choose_4"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='当你刷牙时，注意你的呼吸进出你的鼻子的感觉')
        dispatcher.utter_message(text='专注于当前嘴里面的味道和呼吸的节奏', buttons=[
            {'payload': '/button_part15_1_10_choose_1', 'title': '好的', 'life': 1}, ])
        return []


class part15_1_9_choose_5(Action):
    def name(self) -> Text:
        return "action_part15_1_9_choose_5"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        url = 'https://obs-e912.obs.cn-east-2.myhuaweicloud.com/zy_xm/image/rasa_photo_2021_08_16/relax/little_E_breath_1~1.mp4'
        dispatcher.utter_message(text='找到之后可以做一个深呼吸如果你愿意，你可以随着我肚子上的形状吸气和呼气在我们继续练习时，尽量保持这种深沉而稳定的呼吸', json_message={
            "module_type": 2,
            "video": "little_E_breath_1", }, buttons=[
            {'payload': '/button_part15_1_10_choose_2', 'title': '好~', 'life': 1}, ])
        return []


class part15_1_10_choose_1(Action):
    def name(self) -> Text:
        return "action_part15_1_10_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='最后，吐出泡沫然后漱口。漱口时，注意水的味道和温度——可能是凉的或微温的、无味的或略带矿物质味道的。接着漱口直到感觉到口腔干净清爽', buttons=[
            {'payload': '/button_part15_1_3_choose_6', 'title': '好的，我做完了', 'life': 1}, ])
        return []


class part15_1_10_choose_2(Action):
    def name(self) -> Text:
        return "action_part15_1_10_choose_2"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='现在，尽可能地将眉毛抬高，以收紧前额肌肉。保持在那里，慢慢数到 5，然后轻轻松开 ', buttons=[
            {'payload': '/button_part15_1_11_choose_1', 'title': '抬高……', 'life': 1}, ])
        return []


class part15_1_11_choose_1(Action):
    def name(self) -> Text:
        return "action_part15_1_11_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='接下来，大笑。保持这个姿势数到五，感受脸颊的紧张感。然后，让你的下巴和脸放松 ', buttons=[
            {'payload': '/button_part15_1_12_choose_1', 'title': '下一步呢', 'life': 1}, ])
        return []


class part15_1_12_choose_1(Action):
    def name(self) -> Text:
        return "action_part15_1_12_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='现在，轻轻地将头向后仰，看向天花板。停在那里慢慢数到五......然后让你的头向前点头，伸展脖子后面的肌肉？', buttons=[
            {'payload': '/button_part15_1_13_choose_1', 'title': '好的……', 'life': 1}, ])
        return []


class part15_1_13_choose_1(Action):
    def name(self) -> Text:
        return "action_part15_1_13_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='接下来，让我们继续放松手臂。尽可能高地抬起你的肩膀，让它们几乎擦过你的耳朵。数到五后，放松，让肩膀向着地面的方向，竖直下沉…… ', buttons=[
            {'payload': '/button_part15_1_14_choose_1', 'title': '下沉……', 'life': 1}, ])
        return []


class part15_1_14_choose_1(Action):
    def name(self) -> Text:
        return "action_part15_1_14_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='现在，用力弯曲你的肱二头肌......💪......然后松开，轻轻地舒展你的手臂', buttons=[
            {'payload': '/button_part15_1_15_choose_1', 'title': '接着呢', 'life': 1}, ])
        return []


class part15_1_15_choose_1(Action):
    def name(self) -> Text:
        return "action_part15_1_15_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='接下来，紧紧握紧拳头。慢慢数五……然后放松，让双手张开', buttons=[
            {'payload': '/button_part15_1_16_choose_1', 'title': '做完了', 'life': 1}, ])
        return []


class part15_1_16_choose_1(Action):
    def name(self) -> Text:
        return "action_part15_1_16_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='现在，将肩胛骨向后拉，使它们尽可能靠近。保持这个姿势数到五，然后轻轻松开 ', buttons=[
            {'payload': '/button_part15_1_17_choose_1', 'title': '好', 'life': 1}, ])
        return []


class part15_1_17_choose_1(Action):
    def name(self) -> Text:
        return "action_part15_1_17_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='继续深吸气，屏住呼吸，数到三……然后呼气，呼气时，让肋骨下沉，放松腹部和胸部', buttons=[
            {'payload': '/button_part15_1_18_choose_1', 'title': '做完了√', 'life': 1}, ])
        return []


class part15_1_18_choose_1(Action):
    def name(self) -> Text:
        return "action_part15_1_18_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='接下来我们将专注于你的腿。双膝并拢，在大腿内侧产生紧张感。慢慢数到五后，松开，让你的大腿肌肉放松 ', buttons=[
            {'payload': '/button_part15_1_19_choose_1', 'title': '放松……', 'life': 1}, ])
        return []


class part15_1_19_choose_1(Action):
    def name(self) -> Text:
        return "action_part15_1_19_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='现在，将脚趾向后弯曲，朝向小腿。 这会收紧你的小腿肌肉。')
        dispatcher.utter_message(text='数到五后，松开你的脚趾，感受小腿的紧张感 ', buttons=[
            {'payload': '/button_part15_1_20_choose_1', 'title': '下一步呢', 'life': 1}, ])
        return []


class part15_1_20_choose_1(Action):
    def name(self) -> Text:
        return "action_part15_1_20_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='好了。你马上就完成这套放松方法了现在，把你的脚趾蜷缩，收拢在脚下...', buttons=[
            {'payload': '/button_part15_1_21_choose_1', 'title': '好的', 'life': 1}, ])
        return []


class part15_1_21_choose_1(Action):
    def name(self) -> Text:
        return "action_part15_1_21_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(
            text='让我们最后放松一下，感受你身体中觉得特别紧张的一个部位......，收紧这个部位的肌肉，慢慢地数五下……当你放松时，放松的感觉会进入到你身体的那个地方，释放储存在那里的所有压力……', buttons=[
                {'payload': '/button_part15_1_23_choose_1', 'title': '我做完啦', 'life': 1},
                {'payload': '/button_part15_1_22_choose_1', 'title': '我能再试一次这个放松方式吗', 'life': 1}, ])
        return []


class part15_1_22_choose_1(Action):
    def name(self) -> Text:
        return "action_part15_1_22_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        url = 'https://obs-e912.obs.cn-east-2.myhuaweicloud.com/zy_xm/image/rasa_photo_2021_08_16/relax/little_E_breath_1~1.mp4'
        dispatcher.utter_message(text='当然可以。 首先，让我们再做一次深呼吸。随着我腹部的形状吸气和呼气。注意在我们收紧和放松肌肉时保持平稳的呼吸', json_message={
            "module_type": 2,
            "video": "little_E_breath_1", }, buttons=[
            {'payload': '/button_part15_1_10_choose_2', 'title': '好的', 'life': 1}, ])
        return []


class part15_1_23_choose_1(Action):
    def name(self) -> Text:
        return "action_part15_1_23_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='做完后你的感觉如何呢？', buttons=[
            {'payload': '/button_part15_1_24_choose_1', 'title': '变好了', 'life': 1},
            {'payload': '/button_part15_1_24_choose_2', 'title': '没有变化', 'life': 1},
            {'payload': '/button_part15_1_24_choose_3', 'title': '更不好了', 'life': 1}, ])
        return []


class part15_1_24_choose_1(Action):
    def name(self) -> Text:
        return "action_part15_1_24_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        userid = tracker.current_state()['sender_id']
        conn = common.POOL.connection(shareable=False)
        cursor = conn.cursor()
        try:
            cursor.execute(
                "Select * from `user_result` where `user_info_id` = '" + userid + "' and `is_end` = 0 and `topic_type` = 3 order by create_time desc limit 1;")
            x = cursor.fetchone()
            result_id = x[0]
            sql = "update user_tools_response set feeling_relax_muscle='变好了' where `user_info_id` ='" + userid + "' and `user_result_id` = '" + result_id + "' limit 1;"
            common.connectmysql(sql)
        except:
            dispatcher.utter_message(text='机器人错误 错误码0x050')
            return [UserUtteranceReverted()]
        finally:
            cursor.close()
            conn.close()

        dispatcher.utter_message(text='我很高兴这对你有用')
        dispatcher.utter_message(text='压力会增加我们身体肌肉的紧张程度，渐进式的肌肉放松可以帮助释放一些压力。')
        dispatcher.utter_message(text='而且,当你的身体放松时，你的头脑也会开始感觉更平静、更清晰', buttons=[
            {'payload': '/button_part15_1_25_choose_1', 'title': '嗯嗯', 'life': 1}, ])
        return []


class part15_1_24_choose_2(Action):
    def name(self) -> Text:
        return "action_part15_1_24_choose_2"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        userid = tracker.current_state()['sender_id']
        conn = common.POOL.connection(shareable=False)
        cursor = conn.cursor()
        try:
            cursor.execute(
                "Select * from `user_result` where `user_info_id` = '" + userid + "' and `is_end` = 0 and `topic_type` = 3 order by create_time desc limit 1;")
            x = cursor.fetchone()
            result_id = x[0]
            sql = "update user_tools_response set feeling_relax_muscle='没有变化' where `user_info_id` ='" + userid + "' and `user_result_id` = '" + result_id + "' limit 1;"
            common.connectmysql(sql)
        except:
            dispatcher.utter_message(text='机器人错误 错误码0x050')
            return [UserUtteranceReverted()]
        finally:
            cursor.close()
            conn.close()
        dispatcher.utter_message(text='我知道了其实，没有感觉到变化是一件非常好的事情')
        dispatcher.utter_message(text='这个工具的目标就是帮助你找到一些稳定性，防止你感觉更糟', buttons=[
            {'payload': '/button_part15_1_25_choose_1', 'title': '好的', 'life': 1}, ])
        return []


class part15_1_24_choose_3(Action):
    def name(self) -> Text:
        return "action_part15_1_24_choose_3"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        userid = tracker.current_state()['sender_id']
        conn = common.POOL.connection(shareable=False)
        cursor = conn.cursor()
        try:
            cursor.execute(
                "Select * from `user_result` where `user_info_id` = '" + userid + "' and `is_end` = 0 and `topic_type` = 3 order by create_time desc limit 1;")
            x = cursor.fetchone()
            result_id = x[0]
            sql = "update user_tools_response set feeling_relax_muscle='更不好了' where `user_info_id` ='" + userid + "' and `user_result_id` = '" + result_id + "' limit 1;"
            common.connectmysql(sql)
        except:
            dispatcher.utter_message(text='机器人错误 错误码0x050')
            return [UserUtteranceReverted()]
        finally:
            cursor.close()
            conn.close()
        dispatcher.utter_message(text='好吧，让我们看看我们是否可以用不同的方法帮助你找到放松 ', buttons=[
            {'payload': '/button_part15_1_25_choose_1', 'title': '好的', 'life': 1}, ])
        return []


class part15_1_25_choose_1(Action):
    def name(self) -> Text:
        return "action_part15_1_25_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text='我已经把这个练习放在你的工具箱里，你可以随时使用它', buttons=[
            {'payload': '/button_part15_1_26_choose_1', 'title': '我知道啦', 'life': 1}, ])
        return []


class part15_1_26_choose_1(Action):
    def name(self) -> Text:
        return "action_part15_1_26_choose_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        userid = tracker.current_state()['sender_id']
        sql = "update `user_result` set `is_end` = 1,end_time=now() where `user_info_id`='" + userid + "' and `topic_type` = 3 and `is_end` = 0 order by create_time desc limit 1;"
        common.connectmysql(sql)
        dispatcher.utter_message(text='那期待下次再见啦拜拜~')
        dispatcher.utter_message(text='你已完成当天的实验流程')
        dispatcher.utter_message(text='照顾好自己哟，下次再见！', buttons=[
            {'payload': '/greet', 'title': '拜拜~', 'life': 1}, ])
        return []


class action_ask_relax_slot_1(Action):
    def name(self) -> Text:
        return "action_ask_relax_slot_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        dispatcher.utter_message(text="好的，那么你能告诉我为什么这种呼吸练习对你不起作用吗？ ✏️")
        return []


class action_relax_save_1(Action):
    def name(self) -> Text:
        return "action_relax_save_1"

    async def run(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict[Text, Any]]:
        conversation_rounds(tracker)
        userid = tracker.current_state()['sender_id']
        conn = common.POOL.connection(shareable=False)
        cursor = conn.cursor()
        try:
            cursor.execute(
                "Select * from `user_result` where `user_info_id` = '" + userid + "' and `is_end` = 0 and `topic_type` = 3 order by create_time desc limit 1;")
            x = cursor.fetchone()
            result_id = x[0]
            sql = "update `user_tools_response` set relax_breath_not_work_reason='" + tracker.get_slot('relax_slot_1') + "' where `user_info_id` ='" + userid + "' and `user_result_id` = '" + result_id + "' limit 1;"
            common.connectmysql(sql)
        except:
            dispatcher.utter_message(text='机器人错误 错误码0x020')
            return [UserUtteranceReverted()]
        finally:
            cursor.close()
            conn.close()
        dispatcher.utter_message(text="不用担心。你想尝试一种能让你更加平静和放松的运动吗？这一切都是为了重新连接你的五种感官", buttons=[
            {'payload': '/button_part15_1_1_choose_1', 'title': '好呀，试试看', 'life': 1},
            {'payload': '/button_part14_1_4_choose_2', 'title': '不了，谢谢', 'life': 1}])
        return [SlotSet('relax_slot_1', None)]
